package com.gsoe.judge.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.gsoe.base.model.Result;
import com.gsoe.dto.JudgeExamDTO;
import com.gsoe.dto.UpDateScoreDTO;
import com.gsoe.judge.service.JudgeExamService;
import com.gsoe.po.JudgeExam;
import com.gsoe.vo.PeopleJudgeCacheVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 考试评测表 前端控制器
 * </p>
 *
 * @author xiaoma
 * @since 2024-11-04
 */
@RestController
@RequestMapping("/judge/judgeExam")
public class JudgeExamController {
    @Autowired
    private JudgeExamService judgeExamService;


    @GetMapping("/getPeopleJudgeCache/{examId}/{problemId}")
    public Result<List<PeopleJudgeCacheVO>> getPeopleJudgeCache(@PathVariable("examId") Long examId, @PathVariable("problemId") Long problemId) {
        return Result.success(judgeExamService.getPeopleJudgeCache(examId,problemId));
    }

    @PutMapping("/updateScore")
    @SaCheckPermission("exam_add_update")
    public Result<String>updateScore(@RequestBody UpDateScoreDTO upDateScoreDTO){
        judgeExamService.updateScore(upDateScoreDTO);
        return Result.success("ok");
    }
}
